package com.imdroid.modal;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class RegisterCode {
	/**
	 * The pk of the register code - this can be the imei number from the phone
	 * or the session id from the web
	 */
	private String pk;
	/**
	 * The register code
	 */
	private String registerCode;
	/**
	 * The register code
	 */
	private String phoneNumber;
	/**
	 * The time create
	 */
	private Date TimeCreate;

	/**
	 * The match code
	 */
	private static Map<String, RegisterCode> registerCodes = new HashMap<String, RegisterCode>();

	/**
	 * Get the pk
	 * 
	 * @return the pk
	 */
	public String getPk() {
		return pk;
	}

	/**
	 * Set the pk
	 * 
	 * @param pk
	 *            the pk to set
	 */
	public void setPk(String pk) {
		this.pk = pk;
	}

	/**
	 * Get the register code
	 * 
	 * @return the registerCode
	 */
	public String getRegisterCode() {
		return registerCode;
	}

	/**
	 * Set the register code
	 * 
	 * @param registerCode
	 *            the registerCode to set
	 */
	public void setRegisterCode(String registerCode) {
		this.registerCode = registerCode;
	}

	/**
	 * Get the phone number
	 * 
	 * @return the phoneNumber
	 */
	public String getPhoneNumber() {
		return phoneNumber;
	}

	/**
	 * Set the phone number
	 * 
	 * @param phoneNumber
	 *            the phoneNumber to set
	 */
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	/**
	 * Get the tiem create
	 * 
	 * @return the timeCreate
	 */
	public Date getTimeCreate() {
		return TimeCreate;
	}

	/**
	 * Set the time create
	 * 
	 * @param timeCreate
	 *            the timeCreate to set
	 */
	public void setTimeCreate(Date timeCreate) {
		TimeCreate = timeCreate;
	}

	/**
	 * Add the register code
	 * 
	 * @param pk
	 *            the pk
	 * @param matchCode
	 *            the register code
	 */
	public static void add(String pk, RegisterCode registerCode) {
		registerCodes.put(pk, registerCode);
	}

	/**
	 * Remove the code.
	 * 
	 * @param code
	 *            the code
	 */
	public static void remove(String pk) {
		registerCodes.remove(pk);
	}

	/**
	 * Get the register code
	 * 
	 * @param pk
	 *            the pk
	 * @return the register code
	 */
	public static RegisterCode get(String pk) {
		return registerCodes.get(pk);
	}

	/**
	 * Get the register codes
	 * 
	 * @return all the register codes
	 */
	public static Map<String, RegisterCode> allRegisterCodes() {
		return registerCodes;
	}
}
